/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package character_11_;

import java.util.concurrent.BlockingQueue;

/**
 *
 * @author Administrator
 */
public class Producer3 implements Runnable{

    private BlockingQueue<Integer> productQueue;

    public Producer3(BlockingQueue<Integer> productQueue) {
        this.productQueue = productQueue;
    }
    
    public void run(){
        System.out.println("生产者开始生产整数....");
        for (int i = 0; i <= 10; i++) {
            try {
                productQueue.put(i);
                System.out.println("生产者提供整数" + i);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
    
}
